import requests


def request_ollama(prompt: str, model: str = "qwen2.5:7b") -> str:
    url = "http://localhost:11434/api/generate"
    payload = {
        "model": model,
        "prompt": prompt,
        "think": False,
        "stream": False
    }
    response = requests.post(url, json=payload)
    response.raise_for_status()
    return response.json().get("response", "")

# 示例使用
if __name__ == "__main__":
    result = request_ollama("法国首都在哪里？")
    print(result)